package com.jia.lidao.others.ui.view;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.jia.lidao.R;
import com.jia.lidao.others.enity.OrderInfor;
import com.squareup.picasso.Picasso;

import butterknife.BindView;

public class AppraiseHeaderView extends AbCustomHeaderView {
    @BindView(R.id.iv_good_pic)
    ImageView ivGoodPic;
    @BindView(R.id.tv_goods_message)
    TextView tvGoodsMessage;
    @BindView(R.id.assess_service_ay)
    RatingBar assessServiceAy;
    @BindView(R.id.et_appraise)
    EditText etAppraise;

    public AppraiseHeaderView(Context context) {
        super(context);
    }

    public AppraiseHeaderView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public AppraiseHeaderView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public int getInflateLayout() {
        return R.layout.appraise_header_view;
    }

    @Override
    public void setUpView(View view) {

    }

    public void setData( OrderInfor.OrderBean.OrderGoodsBean orderGoodsBean){
        Picasso.with(getContext()).load(orderGoodsBean.getGoods_pic()).into(ivGoodPic);
        tvGoodsMessage.setText(orderGoodsBean.getGoods_name());
        etAppraise.setText("");
    }

    public String getContentAppraise(){
        String s = etAppraise.getText().toString().trim();
        if(TextUtils.isEmpty(s)){
            return "";
        }else {
            return s;
        }
    }

    public  int getStarsCount (){
        return assessServiceAy.getCheckStarNum();
    }
}